{include file="public:header" /}
<style>
    #lists .w_img_width{width:50px;}
    .weixin .w_img_width{width:290px;height:145px;}
    .w_preview li{line-height: 35px;}
    .w_preview label{display:inline-table;width:85px;text-align:right;vertical-align: top;}
    .weixin{border:1px solid #ccc;border-radius:20px;width:290px;padding:10px;margin-left:70px;color:#404040;font-size:14px;}
    .weixin p{line-height: 25px;}
    .w_replay{width:360px;text-align:center;color:#404040;font-size:14px;line-height: 35px;}
    .upload_btn{display:inline-table;float:none;vertical-align: middle;}
    .J_tabs li a{color:#666;}
</style>
<!--添加图文回复-->
<div class="subnav">
    <div class="content_menu ib_a blue line_x">
        <a href="{:url('add')}" {if condition="$e_type eq 2"}class="on"{/if}><em>关注回复</em></a><span>|</span>
        <a href="{:url('index',['e_type'=>3])}" {if condition="$e_type eq 3"}class="on"{/if}><em>菜单事件</em></a>
    </div>
</div>
<form id="info_form" action="{:url('WeixinFllow/addDo')}" onsubmit="return check();" method="post" enctype="multipart/form-data">
    <div class="pad_lr_10">
        <div class="col_tab">
            <ul class="J_tabs tab_but cu_li">
                <li><a href="{:url('add',['type'=>1,'e_type'=>$e_type])}">添加文本回复</a></li>
                <li class="current">添加图文回复</li>
                <li><a href="{:url('add',['type'=>3,'e_type'=>$e_type])}">添加多图文回复</a></li>
            </ul>
            <div class="J_panes">
                <div class="content_list pad_10 clearfix">

                    <div class="pad_lr_10 fl">

                        <input type="hidden" name="event_type" id="e_type" value="{$e_type}">
                        <input type="hidden" name="type" value="{$type}">
                        <ul class="w_preview">
                            {if condition="$e_type eq 3"}
                            <li>
                                <label for="keywords">绑定微信菜单：</label>
                                <select name="keyword" id="keywords">
                                    {volist name='event_menu' id='vo'}
                                    <option value="{$vo.alias}">{$vo.name}</option>
                                    {/volist}
                                </select>
                            </li>
                            {/if}
                            <li><label for="title">标题：</label><input type="text" name="data[Title]" id="title" class="input-text" size="47"></li>
                            <li><label for="img">封面图片：</label><input type="text" name="data[PicUrl]" value="" id="img" class="input-text" size="36">
                                <div id="J_upload_img" class="upload_btn" onclick="ajaxUpload('J_upload_img','img');"><span>选择图片</span></div>
                                <span style="color:#ff0000;">图片建议360*200</span>
                            </li>
                            <li><label for="url">链接地址：</label><input type="text" class="input-text" name="data[Url]" size="47" id="url"></li>
                            <li><label for="description">简介：</label><textarea name="data[Description]" id="description" class="input-text" style="width:300px;height:60px;"></textarea></li>
                        </ul>
                        <div class="mt10"><input type="submit" value="提交" id="dosubmit" name="" class="btn btn_submit" style="margin:0 0 10px 100px;"><br /><br /><br /></div>
                    </div>
                </div>

            </div>
        </div>
    </div>
</form>
{include file="public:footer"}
<script src="__PUBLIC__/js/plugins/fileuploader.js"></script>
<script>
    $(function() {
        $.formValidator.initConfig({formid:"info_form",autotip:true});
        $("#title").formValidator({onshow:'请填写标题',onfocus:'请填写标题'}).inputValidator({min:1,onerror:'请填写标题'});
        $("#img").formValidator({onshow:'请上传封面图片',onfocus:'请上传封面图片'}).inputValidator({min:1,onerror:'请上传封面图片'});
        $("#keywords").formValidator({onshow:'请选择菜单',onfocus:'请选择菜单'}).inputValidator({min:0,onerror:'请选择菜单'});

    });
    function ajaxUpload(btn,input){
        //上传图片

        var img_uploader = new qq.FileUploaderBasic({
            allowedExtensions: ['jpg','gif','jpeg','png','swf'],
            button: document.getElementById(btn),
            multiple: false,
            action: "{:url('WeixinFllow/ajaxUploadImg')}",
            inputName: 'img',
            forceMultipart: true, //用$_FILES

            showMessage: function(message){
                $.yingloujie.tip({content:message, icon:'error'});
            },
            onSubmit: function(id, fileName){
                $('#'+btn).addClass('btn_disabled').find('span').text('上传中，请稍候...');
            },
            onComplete: function(id, fileName, result){
                $('#'+btn).removeClass('btn_disabled').find('span').text('上传');
                if(result.status == '1'){
                    $('#'+input).val(result.data);
                } else {
                    $.yingloujie.tip({content:result.msg, icon:'error'});
                }
            }
        });
    }
</script>
</body>
</html>